﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using FanaticRock.Core.Enums;
using FanaticRock.Core.Helpers;

namespace FanaticRock.Converters
{
    class PlayModeEnumToSVGUriConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value is PlayModeEnum  evalue)
            {
                switch (evalue)
                {
                    case PlayModeEnum.ListLoop:
                        return UriHelper.GetUri(@"pack://application:,,,/FanaticRock.Resources;component/PlayModeEnum/ListLoop.svg");
                    case PlayModeEnum.SingleLoop:
                        return UriHelper.GetUri(@"pack://application:,,,/FanaticRock.Resources;component/PlayModeEnum/SingleLoop.svg");
                    case PlayModeEnum.Random:
                        return UriHelper.GetUri(@"pack://application:,,,/FanaticRock.Resources;component/PlayModeEnum/Random.svg");
                    case PlayModeEnum.OneByOne:
                        return UriHelper.GetUri(@"pack://application:,,,/FanaticRock.Resources;component/PlayModeEnum/OneByOne.svg");
                    case PlayModeEnum.Heart:
                        return UriHelper.GetUri(@"pack://application:,,,/FanaticRock.Resources;component/PlayModeEnum/Heart.svg");
                    default:
                        throw new NotImplementedException();
                }
            }
            throw new NotImplementedException();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #region singleton

        private static Lazy<PlayModeEnumToSVGUriConverter> _instance = new Lazy<PlayModeEnumToSVGUriConverter>();
        public static PlayModeEnumToSVGUriConverter Instance => _instance.Value;

      

        #endregion
    }
}
